F1='DLV_PHAR'
F11='DLVPHADO'
SET EXCLU OFF
USE &DR&F1
INDEX ON COMP_CODE+delv_order TO &DR&F11
USE
F1='DLV_PHAR'
F2='DLV_TEMP'
SELE 1
SET EXCLU OFF
USE &DR&F1 INDEX &DR&F11
DO WHILE .T.
   DO ADDRDOR1
   @ 8, 5  SAY "ADD TO"
   COMPCOD = SPACE(4)
   set colo to bg+/b,w+/n
   @ 7,1 clear to 23,78
   CNT=0
   KODE=SPACE(4)
   kunci=space(4)
   do boxe with 11,3,'Enter Initial of Client Code : ','KUNCI','N','BG','W+','N',4,.T.,.T.
   if lastkey()=27
      set colo to bg+/b,w+/n
      return
   endif

   do getcompc
   if lastkey()=27
      return
   endif
   SET COLO TO BG+/B,W+/N
   @ 7,1 CLEAR TO 23,78
   SET INDE TO &DR&F11
   SEEK COMPCOD
   IF EOF()
      @ 11, 25  SAY ">>> THIS CODE DOES NOT CORRESPOND <<<"
      @ 12, 25  SAY ">>>>>>>> TO A LISTED COMPANY <<<<<<<<"
      @ 13, 25  SAY ">>>>>>> PLEASE ENTER AGAIN  ! <<<<<<<"
      STORE 0 TO MX
      DO WHILE MX=0
         MX=INKEY()
      ENDDO
      DO CASE
         CASE MX=13
          LOOP
      ENDCASE
      LOOP
   ELSE
      NOR=RECNO()
      EXIT
   ENDIF
ENDDO

COMPNAME=CLIENT
@ 10,3 SAY 'CLIENT NAME : '+COMPNAME

CNT=0
SELE 1
GOTO NOR
DO WHILE .NOT. EOF()
   IF COMP_CODE<>COMPCOD
      SKIP
      LOOP
   ENDIF
   IF DELV_PRINT
      SKIP
      LOOP
   ENDIF
   CNT=CNT+1
   NUMDO=delv_order
   DO WHILE delv_order=NUMDO .AND. .NOT. EOF()
      SKIP
   ENDDO
   SELE 1
ENDDO
IF CNT=0
   SET EXCLU OFF
   CLOSE DATA
   CLOSE INDEX
   RETURN
ENDIF
DECLARE FIL1[CNT]
DECLARE FIL2[CNT]
DECLARE FIL3[CNT]
CR=0
SELE 1
GOTO NOR
DO WHILE .NOT. EOF()
   IF COMP_CODE<>COMPCOD
      SKIP
      LOOP
   ENDIF
   IF DELV_PRINT
      SKIP
      LOOP
   ENDIF
   CR=CR+1
   FIL1[CR]=SUBSTR(DELV_ORDER,7,4)+'     '+DTOC(DATE_DELV)+'   '+PO_NUMB_CL
   FIL2[CR]=DELV_ORDER
   FIL3[CR]=PO_NUMB_CL
   NUMDO=delv_order
   DO WHILE delv_order=NUMDO .AND. .NOT. EOF()
      SKIP
   ENDDO
   SELE 1
ENDDO
DO WHILE .T.
   @ 11,  3  TO 23, 47    DOUBLE
   @ 12, 5 SAY 'D.O. #   DATE       P.O. #'
   @ 13, 4 TO 13,46
   inkey()
   cari=achoice(14,5,22,46,fil1)
   mix=lastkey()
   DO CASE
      CASE MIX=13
        DONUM=FIL2[CARI]
        PONUM=FIL3[CARI]
        EXIT
      CASE MIX=27
        SET EXCLU OFF
        CLOSE DATA
        CLOSE INDEX
        RETURN
   ENDCASE
ENDDO
DO DO_ADD1
CLOSE DATA
CLOSE INDEX
RETURN



